'use strict';
const db = uniCloud.database()
const coll1 = db.collection('user')
const coll2 = db.collection('xinyuan')
const dbCmd = db.command
exports.main = async (event, context) => {
	if (event.flag == 'chongzhi') {
		let res1 = await coll1.where({
			flag: 'flag'
		}).update({
			dianzanjihui: 3,
			status: 1,
			xinyuan: '',
			dianzanlist: []
		})
		return res1
	} else if (event.flag == 'qingkong') {
		let res2 = coll2.where({
			_id: dbCmd.exists(true)
		}).remove()
		return res2
	}
};
